package com.yeyks.dal.dao;

import com.yeyks.dal.domain.OrderInfo;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

public interface OrderInfoMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(OrderInfo record);

    OrderInfo selectByPrimaryKey(Integer id);

    List<OrderInfo> selectAll();

    int updateByPrimaryKey(OrderInfo record);

    int insertReturnId(OrderInfo record);

    List<OrderInfo> selectByUser(@Param("id") Integer id, @Param("status") List<Integer> status,
                                 @Param("offset") Integer offset, @Param("maxrow") Integer maxrow);

    OrderInfo selectByOrderNo(@Param("orderNo") String orderNo);

    List<Map> selectFromHotelMgr2(@Param("hotelIds") List<Integer> hotelIds, @Param("orderStart") Date orderStart, @Param("orderEnd") Date orderEnd
    );

    List<Map> select4Stat(@Param("hotelIds") List<Integer> hotelIds, @Param("groupByDtFmt") String groupByDtFmt,
                          @Param("orderStart") Date orderStart, @Param("orderEnd") Date orderEnd);

    List<Map> selectFromHotelMgr(@Param("hotelIds") List<Integer> hotelIds, @Param("statusList") List<Integer> statusList,
                                 @Param("orderNo") String orderNo, @Param("orderStart") String orderStart,
                                 @Param("orderEnd") String orderEnd, @Param("checkIn") String checkIn,
                                 @Param("checkOut") String checkOut, @Param("keyword") String keyword,
                                 @Param("offset") Integer offset, @Param("maxrow") Integer maxrow
    );

    int selectFromHotelMgrCount(@Param("hotelIds") List<Integer> hotelIds, @Param("statusList") List<Integer> statusList,
                                @Param("orderNo") String orderNo, @Param("orderStart") String orderStart,
                                @Param("orderEnd") String orderEnd, @Param("checkIn") String checkIn,
                                @Param("checkOut") String checkOut, @Param("keyword") String keyword
    );

    int updateToLiving();

    int updateToPostCheckOut();

    List<Map> selectHotelOrderTopList(@Param("hotelIds") List<Integer> hotelIds, @Param("orderStart") Date orderStart, @Param("orderEnd") Date orderEnd);

    int updateScore(@Param("id") Integer id, @Param("score") Integer score);

    Integer getHotelAvgScore(@Param("id") Integer id);

    Integer getHotelIdByOrderId(@Param("id") Integer id);

    List<OrderInfo> selectPreCheckOut();

    List<Map> selectOrderByPage(Map<String, Object> map);

    Long selectOrderByPageCount(Map<String, Object> map);

    Integer updateOrderStatus(@Param("orderNo") String orderNo, @Param("status") Integer status);

    Integer updateOrderDelStatus(@Param("orderNo") String orderNo, @Param("status") Integer status);

    List<OrderInfo> selectNoPayOrder(@Param("status") Integer status);

    Integer updateScoreByOrderNo(@Param("orderNo") String orderNo, @Param("score") Integer score);

    Integer getHotelIdByOrderNo(@Param("orderNo") String orderNo);

    Integer updateScoreAndStatusByOrderNo(@Param("orderNo") String orderNo, @Param("score") Integer score, @Param("status") Integer status);

    void updateUserIdByOldUserId(@Param("newUserId") Integer newUserId, @Param("oldUserId") Integer oldUserId);
}